<form name="frmMock" class="form-horizontal" ng-init="dvm.init()" ng-submit="dvm.copy(frmMock.$valid)" novalidate>
  <div class="modal-header">
    <button type="button" class="close" ng-click="dvm.cancel()">&times;</button>
    <h4 class="modal-title">复制MOCK数据</h4>
  </div>
  <div class="modal-body">
    <div class="form-group" ng-if="dvm.type == 'folder'">
      <label class="col-sm-3 col-md-2 control-label">源文件夹：</label>
      <div class="col-sm-9 col-md-10">
        <input name="source" type="text" class="form-control" ng-model="dvm.source" readonly>
      </div>
    </div>
    <div class="form-group" ng-if="dvm.type == 'folder'">
      <label class="col-sm-3 col-md-2 control-label">目标文件夹：</label>
      <div class="col-sm-9 col-md-10">
        <input name="target" type="text" class="form-control" ng-model="dvm.target"
            pattern="^(/\{?[0-9A-Za-z_-]+\}?)+$" placeholder="/folder/.../folder" required autofocus
            ng-class="{'x-invalid': frmMock.$submitted && frmMock.target.$invalid}">
        <p class="text-danger" ng-show="frmMock.$submitted && frmMock.target.$error.required">文件夹路径不能为空</p>
        <p class="text-danger" ng-show="frmMock.$submitted && frmMock.target.$error.pattern">文件夹路径格式错误</p>
        <p class="text-danger" ng-show="frmMock.$submitted && dvm.target == dvm.source">不可与源文件夹路径相同</p>
        <p class="text-danger" ng-show="frmMock.$submitted && dvm.nestpath">不可是源文件夹的子路径</p>
      </div>
    </div>
    <div class="form-group" ng-if="dvm.type == 'file'">
      <label class="col-sm-3 col-md-2 control-label">源文件：</label>
      <div class="col-sm-9 col-md-10">
        <div class="input-group">
          <input name="source" type="text" class="form-control" ng-model="dvm.source" readonly>
          <span class="input-group-addon">{{dvm.extname}}</span>
        </div>
      </div>
    </div>
    <div class="form-group" ng-if="dvm.type == 'file'">
      <label class="col-sm-3 col-md-2 control-label">目标文件：</label>
      <div class="col-sm-9 col-md-10">
        <div class="input-group">
          <input name="target" type="text" class="form-control" ng-model="dvm.target"
              pattern="^(/\{?[0-9A-Za-z_-]+\}?)+$" placeholder="/folder/.../file" required autofocus
              ng-class="{'x-invalid': frmMock.$submitted && frmMock.target.$invalid}">
          <span class="input-group-addon">{{dvm.extname}}</span>
        </div>
        <p class="text-danger" ng-show="frmMock.$submitted && frmMock.target.$error.required">文件路径不能为空</p>
        <p class="text-danger" ng-show="frmMock.$submitted && frmMock.target.$error.pattern">文件路径格式错误</p>
        <p class="text-danger" ng-show="frmMock.$submitted && dvm.target == dvm.source">不可与源文件路径相同</p>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-3 col-md-offset-2 col-sm-9 col-md-10">
        <label class="checkbox-inline" ng-if="dvm.type == 'folder'">
          <input name="type" type="checkbox" value="true" ng-model="dvm.ignored.folder">覆盖同名文件夹
        </label>
        <label class="checkbox-inline">
          <input name="type" type="checkbox" value="true" ng-model="dvm.ignored.file">覆盖同名文件
        </label>
        <label class="checkbox-inline" ng-if="dvm.type == 'folder'">
          <input name="type" type="checkbox" value="true" ng-model="dvm.movable">删除源文件夹
        </label>
        <label class="checkbox-inline" ng-if="dvm.type == 'file'">
          <input name="type" type="checkbox" value="true" ng-model="dvm.movable">删除源文件
        </label>
      </div>
    </div>
  </div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-primary" ng-disabled="frmMock.$invalid">复制</button>
    <button type="button" class="btn btn-default" ng-click="dvm.cancel()">取消</button>
  </div>
</form>
